The TextField Component > Using the TextField component > Creating an application with the TextField component |
Creating an application with the TextField component
The following procedure describes how to use the TextField component. In this procedure, you enter simple ActionScript code that configures the visual display of the text field, and then only allows users to enter numbers into the field. For more complex examples, see Examples for the TextField component.
To create a simple application using the TextField component:
1 |
Open Macromedia Flash MX. |
2 |
Open the Components panel (Window > Components). |
3 |
Select Flash UI Components Set 5 from the Components panel menu. |
4 |
Drag an instance of the TextField component onto the stage. |
5 |
Set the instance name of the TextField to myTextField_txf. |
6 |
Add a new layer to the main timeline and name it actions. |
7 |
Select the new layer and open the Actions panel (Window > Actions). |
8 |
In the Actions panel add the following code: |
//Create a 3D border myTextField_txf.borderType = "bevel"; |
|
9 |
Save, publish, and test the movie. There will be a text field in the movie which will only allow you to type numbers in it. If you try to type any character except a number, you will get an error icon. |
You can view the code for this example in the text_simple_example.fla example file.